#ifndef STREAMINGBUFFEREDAI_H
#define STREAMINGBUFFEREDAI_H

#include <QWidget>
#include <QMessageBox>
#include "ui_streamingbufferedai.h"
#include "simplegraph.h"
#include "configuredialog.h"
#include <string.h>
#include <QtCore/QCoreApplication>
#include <iostream>
#include <QObject>

class FileNamer : public QObject
{
    Q_OBJECT
public:
    FileNamer() { m_value = ""; }
    void setValue(QString value);

signals:
    void valueChanged(QString newValue);
    void AmySignal();
private:
    QString m_value;
};


class DisplayAgent : public QObject
{
    Q_OBJECT
public:

    DisplayAgent() { m_value = ""; }

public slots:
    void update(QString value);

private:
    QString m_value;

};

class AI_StreamingBufferedAi : public QDialog
{
	Q_OBJECT
public:  

	AI_StreamingBufferedAi(QDialog *parent = 0, Qt::WindowFlags flags = 0);
    ~AI_StreamingBufferedAi();
	void Initialize();
	void SetConfigureDialog(ConfigureDialog * dialog){configureDialog = dialog;}
	void SetConfigureParameter(ConfigureParameter value){configure = value;}
	void ConfigureDevice();
	void ConfigureGraph();
	void InitializeList();
	void SetXCord();
	void CheckError(ErrorCode errorCode);
    void TableWidget(QString fname, QString ret,QString a);
    static void BDAQCALL OnDataReadyEvent(void * sender, BfdAiEventArgs * args, void * userParam);
    static void BDAQCALL OnOverRunEvent(void * sender, BfdAiEventArgs * args, void * userParam);
    static void BDAQCALL OnCacheOverflowEvent(void * sender, BfdAiEventArgs * args, void * userParam);
    static void BDAQCALL OnStoppedEvent(void * sender, BfdAiEventArgs * args, void * userParam);
    void start();
    void auto_stop_ctrl();
    void auto_start_ctrl();

    static FileNamer *a;
    static DisplayAgent *b;

 private:
	Ui::AI_StreamingBufferedAiClass ui;
	SimpleGraph *graph;
	ConfigureDialog *configureDialog;
	ConfigureParameter configure;
    WaveformAiCtrl * waveformAiCtrl;
    double *scaledData;
    static const int sectionCount = 0;

	int rawDataBufferLength;
	TimeUnit timeUnit;
    double xInc;
public  slots:
    void DivValueChanged(int value);
    void ButtonConfigureClicked();
    void ButtonStartClicked();
    void ButtonPauseClicked();
    void ButtonStopClicked();

};



#endif // STREAMINGBUFFEREDAI_H
